package com.agent.util;

import com.weixin.pojo.AccessToken;
import org.apache.commons.collections.map.HashedMap;

import java.util.HashMap;
import java.util.Map;

public class Constants {

    public static Map<String,String> machineTypeMap = new HashMap<>();
    public static Map<Integer,String> levelCountMap = new HashMap<>();
    public static Map<String,String> systemModelMap = new HashMap<>();
    public static Map<String,String> addressMap = new HashMap<>();
    public static Map<String,String> rankMap = new HashMap<>();
    public static Map<String,String> statusMap = new HashMap<>();
    public static Map<String,String> sourceMap = new HashMap<>();
    public static Map<String,AccessToken> tokenMap = new HashMap<>();
    public static Map<String,Integer> roleMap = new HashedMap();
    public static String SYSTEM_MODEL = "system-model"; //系统派单模式
    public static String satisfied_00 = "0"; // 满意
    public static String satisfied_01 = "1"; // 不满意
    public static String INIT_PASSWORD = "123456"; // 初始密码
    public static final String SYSTEM = "QYWX";
    public static final String ENGINEER_NOTIFY = "engineer-notify"; //工程师收到派单提示
    public static final String CREATE_MSG = "create-msg"; // 工单创建后发送消息
    public static final String NOWORKER_CREATE_MSG = "noworker-create-msg"; // 非工作时间 工单创建后发送消息

    public static final String CREATOR_NOTIFY = "creator-notify";//给客户主动推送
    public static final String CALLER_NOTIFY_TO_CREATOR = "caller-notify-to-creator";// 坐席修改维修时间后 给客户主动推送
    public static final String CALLER_NOTIFY = "caller-nofify";//给坐席主动推送
    public static final String USER_NAME = "userName";
    public static final String TO_CUSTOMER_SATISFACTION = "to-customer-satisfaction";//提醒客户去做满意度评价
    public static final String WX_REPAIRE_TOKEN = "wx-repaire";//微信报修页面token

    static {
        // // 01:电脑  02:电话
        machineTypeMap.put("01","硬件");
        machineTypeMap.put("02","软件");
        machineTypeMap.put("03","账号问题");
        machineTypeMap.put("04","网络后端");
        machineTypeMap.put("05","公司内网");
        machineTypeMap.put("06","协同平台");
        machineTypeMap.put("07","其他");
        // 01:兆丰  02:科汇 03：百丽
        addressMap.put("01","兆丰");
        addressMap.put("02","科汇");
        addressMap.put("03","百丽");
        addressMap.put("04","其他");
        addressMap.put("05","杨浦");
        // 01:调配 02:已接单 03:服务中 04:结束服务
        statusMap.put("00","待流转");
        statusMap.put("01","待调配");
        statusMap.put("02","已接单");
        statusMap.put("03","服务中");
        statusMap.put("04","服务完成待评价");
        statusMap.put("05","已评价");
        statusMap.put("06","待接单");

        roleMap.put("售后工程师",3);
        roleMap.put("座席",2);
        roleMap.put("班长座席",4);
        roleMap.put("客户",5);

        rankMap.put("1","高级工程师");
        rankMap.put("2","中级工程师");
        rankMap.put("3","中级工程师");
        rankMap.put("4","初级工程师");
        rankMap.put("5","初级工程师");

        systemModelMap.put("0","抢单模式");
        systemModelMap.put("1","自动派单模式");

        levelCountMap.put(1,"one-level-count");
        levelCountMap.put(2,"two-level-count");
        levelCountMap.put(3,"three-level-count");
        levelCountMap.put(4,"four-level-count");
        levelCountMap.put(5,"five-level-count");

        sourceMap.put("1","电话报修");
        sourceMap.put("2","邮件报修");
        sourceMap.put("3","微信报修");
        sourceMap.put("4","二维码");
        sourceMap.put("5","其他");
    }

    public static  String getSourceMap(String key){
        if(sourceMap.containsKey(key)){
            return sourceMap.get(key);
        }
        return key;
    }

    public static  String getSystemModel(String key){
        if(systemModelMap.containsKey(key)){
            return systemModelMap.get(key);
        }
        return key;
    }
    public static Integer getRole(String position){
        if (roleMap.containsKey(position)){
            return roleMap.get(position);
        }
        return 0;
    }

    public static String getMachineType(String machineType){
        if(machineTypeMap.containsKey(machineType)){
            return machineTypeMap.get(machineType);
        }
        return machineType;
    }

    public static String getMachineTypeByValue(String machineTypeValue){
        if(machineTypeMap.containsValue(machineTypeValue)){
            final String[] key = {""};
            machineTypeMap.forEach(( k,  v) ->{
                if(v.equals(machineTypeValue)){
                    key[0] = k;
                    return;
                }
            });
            return key[0];
        }
        return machineTypeValue;
    }

    public static String getAddressByValue(String addressValue){
        if(addressMap.containsValue(addressValue)){
            final String[] key = {""};
            addressMap.forEach(( k,  v) ->{
                if(v.equals(addressValue)){
                    key[0] = k;
                    return;
                }
            });
            return key[0];
        }
        return addressValue;
    }

    public static String getAddress(String address){
        if(addressMap.containsKey(address)){
            return addressMap.get(address);
        }
        return address;
    }

    public static String getStatus(String status){
        if(statusMap.containsKey(status)){
            return statusMap.get(status);
        }
        return status;
    }
}
